<template>
  <div>
    <div>
      <el-table class="tl-table" :height="localHeight" ref="mainTable" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <!--            <el-table-column type="selection" width="55px" fixed="left"></el-table-column>-->
        <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
        <el-table-column prop="name" label="会议主题" min-width="180px" sortable="custom" sort-by="name" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispmeettypeid" label="会议类型" width="200px" sortable="custom" sort-by="meettypeid" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="place" label="会议地点" width="200px" sortable="custom" sort-by="place" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="begintime" label="会议开始时间" width="170px" sortable="custom" sort-by="begintime" align="center" header-align="center" :formatter="dateTimeFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="endtime" label="会议结束时间" width="170px" sortable="custom" sort-by="endtime" align="center" header-align="center" :formatter="dateTimeFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="keywords" label="会议标签" width="180px" sortable="custom" sort-by="keywords" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispstate" label="会议状态" width="100px" sortable="custom" sort-by="state" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="launchusername" label="会议发起人" width="100px" sortable="custom" sort-by="launchusercode" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column label="操作" width="110px" v-slot="scope" fixed="right">
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
              <el-dropdown-item icon="el-icon-edit" @click.native="openEditDialog('editForm', scope.row.id)">编辑</el-dropdown-item>
              <el-dropdown-item icon="el-icon-delete" @click.native="doLimitDelete(scope.row)">删除</el-dropdown-item>
              <el-dropdown-item icon="el-icon-s-data" @click.native="openCountDialog(scope.row)" v-show="scope.row.state === 1">人员统计</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
      <tl-edit ref="editForm" @refresh="doRefresh" sourceType="meetCreate"></tl-edit>
      <tl-count ref="countForm" sourceType="meetCreate"></tl-count>
    </div>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import tlEdit from './edit'
import tlCount from '@/views/meet/meetManage/count'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'meetCreatTableComp',
  mixins: [mixin_list],
  components: { tlEdit, tlCount },
  data() {
    return {
      description: '会议-列表查询',
      urlPrefix: '/meet/meetManage/',
      url: {
        queryCodeList: '/meet/meetManage/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'begintime asc,id',
        sord: 'desc'
      },
      meetType: [],
      meetTypeList: [],
      isQueryOnCreated: false
    }
  },
  props: {
    localHeight: {
      type: Number,
      default: 0
    }
  },
  methods: {
    // 有会议室则取会议室 无则取会议地点
    afterLoadData() {
      this.datas.forEach(row => {
        if (row.airlinecompany && row.airlinecompany !== "" && row.airlinecompany !== null) {
          row.place = row.airlinecompany
        }
      })
    },
    /** 限制删除*/
    doLimitDelete(data) {
      if (data.state === 1) {
        this.$tap.alert('发布的会议不允许删除！', 'warning')
        return
      }
      this.doDelete(data.id)
    },
    // 打开人员统计对话框
    openCountDialog(row) {
      this.$refs.countForm.id = row.id
      this.$refs.countForm.visible = true
      this.$refs.countForm.clickBtn = ''
      this.$refs.countForm.queryParam = { qry_meetid: row.id }
      this.$refs.countForm.showSpecialContent = row.sourceapp === 'mpm'
      this.$refs.countForm.doQuery()
      this.$refs.countForm.queryPersonStaticCount()
    },
    doSearch() {
        this.loadData({})
    }
  },
  created() {
  }
}
</script>

<style scoped></style>
